package com.alibaba.csp.sentinel.dashboard.config;

/**
 * packageName com.alibaba.csp.sentinel.dashboard.config.NacosRuleConstants
 *
 * @author liudonghai
 * @version JDK 11
 * @date 2025/9/12
 * @description TODO
 */
public class NacosRuleConstants {
    /**
     * 默认配置分组ID
     */
    public static final String GROUP_ID = "SENTINEL_GROUP";

    /**
     * 流控规则数据ID后缀
     */
    public static final String FLOW_DATA_ID_POSTFIX = "-flow-rules";
    /**
     * 降级规则数据ID后缀
     * 用于标识降级规则在Nacos中的配置名称后缀
     */
    public static final String DEGRADE_DATA_ID_POSTFIX = "-degrade-rules";

    /**
     * 系统规则数据ID后缀
     * 用于标识系统规则在Nacos中的配置名称后缀
     */
    public static final String SYSTEM_DATA_ID_POSTFIX = "-system-rules";

    /**
     * 授权规则数据ID后缀
     * 用于标识授权规则在Nacos中的配置名称后缀
     */
    public static final String AUTHORITY_DATA_ID_POSTFIX = "-authority-rules";

    /**
     * 网关API规则数据ID后缀
     * 用于标识网关API规则在Nacos中的配置名称后缀
     */
    public static final String GATEWAY_API_DATA_ID_POSTFIX = "-gateway-api-rules";

    /**
     * 网关流控规则数据ID后缀
     * 用于标识网关流控规则在Nacos中的配置名称后缀
     */
    public static final String GATEWAY_FLOW_DATA_ID_POSTFIX = "-gateway-flow-rules";

    /**
     * 热点参数规则数据ID后缀
     */
    public static final String PARAM_FLOW_DATA_ID_POSTFIX = "-param-rules";

    /**
     * 集群映射数据ID后缀
     */
    public static final String CLUSTER_MAP_DATA_ID_POSTFIX = "-cluster-map";
    /**
     * 集群服务端传输配置数据ID后缀
     * 用于标识集群服务端传输配置在Nacos中的配置名称后缀
     */
    public static final String CLUSTER_SERVER_TRANSPORT_DATA_ID_POSTFIX = "-cluster-server-transport-config";

    /**
     * 集群服务端流控配置数据ID后缀
     * 用于标识集群服务端流控配置在Nacos中的配置名称后缀
     */
    public static final String CLUSTER_SERVER_FLOW_DATA_ID_POSTFIX = "-cluster-server-flow-config";

    /**
     * 集群客户端配置数据ID后缀
     * 用于标识集群客户端配置在Nacos中的配置名称后缀
     */
    public static final String CLUSTER_CLIENT_CONFIG_DATA_ID_POSTFIX = "-cluster-client-config";


    /**
     * 集群客户端配置数据ID后缀
     * cc for `cluster-client`
     */
    public static final String CLIENT_CONFIG_DATA_ID_POSTFIX = "-cc-config";

    /**
     * 集群服务端传输配置数据ID后缀
     * cs for `cluster-server`
     */
    public static final String SERVER_TRANSPORT_CONFIG_DATA_ID_POSTFIX = "-cs-transport-config";

    /**
     * 集群服务端流控配置数据ID后缀
     */
    public static final String SERVER_FLOW_CONFIG_DATA_ID_POSTFIX = "-cs-flow-config";

    /**
     * 集群服务端命名空间配置数据ID后缀
     */
    public static final String SERVER_NAMESPACE_SET_DATA_ID_POSTFIX = "-cs-namespace-set";

    private NacosRuleConstants() {
    }
    public static String getApiDefinitionDataId(String app) {
        return String.format("%s@@api-definitions", app);
    }

    public static String getSystemDataId(String app) {
        return String.format("%s@@system-rules", app);
    }
}
